var myChart = echarts.init(document.getElementById('main'));
// 指定图表的配置项和数据
var option = {
	tooltip: {
		trigger: 'axis'
	},
//	legend: {
//		data: ['直接访问', '搜索引擎']
//	},
	grid: {
        x: 35,
        y: 20,
        x2: 30,
        y2: 20,
        // width: {totalWidth} - x - x2,
        // height: {totalHeight} - y - y2,
        backgroundColor: 'rgba(0,0,0,0)',
        borderWidth: 1,
        borderColor: '#ccc'
    },
	toolbox: {
		show: false,
		feature: {
			mark: {
				show: true
			},
			dataView: {
				show: true,
				readOnly: false
			},
			magicType: {
				show: true,
				type: ['line', 'bar', 'stack', 'tiled']
			},
			restore: {
				show: true
			},
			saveAsImage: {
				show: true
			}
		}
	},
	calculable: true,
	xAxis: [{
		type: 'category',
		boundaryGap: false,
		data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
	}],
	yAxis: [{
		type: 'value'
	}],
	series: [{
		name: '直接访问',
		type: 'line',
		stack: '总量',
		itemStyle: {
			normal: {
				areaStyle: {
					type: 'default'
				}
			}
		},
		data: [90, 120, 60, 80, 90, 90, 120]
	}, {
		name: '搜索引擎',
		type: 'line',
		stack: '总量',
		itemStyle: {
			normal: {
				areaStyle: {
					type: 'default'
				}
			}
		},
		data: [80, 30, 90, 40, 90, 30, 90]
	}]
};

// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);